As such a cylinder apparatus having the function of detection, conventionally, there is an apparatus described in Patent Literature 1 (Japanese Unexamined Patent Publication No. 129410/1985 (Tokukaishou 60-129410)).
FIG. 5 of the above known document illustrates a structure in which: a piston is inserted horizontally movably into a housing; a detection valve configured to check the position to which the piston has been moved with respect to a horizontal direction is arranged in each of right and left end walls of the housing; and a detection rod of each detection valve is operated by the piston.